package com.zjw.service.impl;

import com.zjw.dao.impl.AdminDaoImpl;
import com.zjw.entity.Admin;
import com.zjw.dao.AdminDao;
import com.zjw.service.AdminService;
import com.zjw.utils.ConnectionUtil;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * 管理员信息表(Admin)表服务实现类
 *
 * @author 翟
 * @since 2025-04-09 08:59:18
 */
public class AdminServiceImpl implements AdminService {

    @Override
    public Admin login(Admin admin) {
        Connection conn = ConnectionUtil.getConnection();
        AdminDao adminDao = new AdminDaoImpl(conn);
        Admin admin1 = null;
        try {
            admin1 = adminDao.selectAdminByUsernameAndPassword(admin);
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            ConnectionUtil.closeALL(null , null , conn);
        }
        return admin1;
    }
}
